// ----------------------------------------------------------------------------
// hash.cpp
// ----------------------------------------------------------------------------
#include <fw/base/runtime/hash.h>

namespace fw
{
	// 最後に参照したハッシュ値. 
	uint32_t g_lastHashValue32 = 0;
	uint64_t g_lastHashValue64 = 0;
	
	Hash::Hash(const char* text)
	: m_value(HashValue32(text))
	{
	}
	
	Hash::Hash(uint32_t value)
	: m_value(value)
	{
	}
	
	Hash::Hash()
	: m_value(0)
	{
	}
	
	Hash::operator const uint32_t() const
	{
		return m_value;
	}
	
	Hash::operator const bool() const
	{
		return (m_value != 0) ? true : false;
	}
	
	bool Hash::operator==(const Hash& other) const
	{
		return (other.m_value == m_value) ? true : false;
	}

	HashL::HashL(const char* text)
	: m_value(HashValue64(text))
	{
	}
	
	HashL::HashL(uint64_t value)
	: m_value(value)
	{
	}
	
	HashL::HashL()
	: m_value(0)
	{
	}
	
	HashL::operator const uint64_t() const
	{
		return m_value;
	}
	
	HashL::operator const bool() const
	{
		return (m_value != 0) ? true : false;
	}
	
	bool HashL::operator==(const HashL& other) const
	{
		return (other.m_value == m_value) ? true : false;
	}
	
} // namespace fw
